#include "Common.glsl"


#if VERTEX
    in layout(location = POSITION) vec2 in_position;
    out vec2 texCoord;

    void main()
    {
        gl_Position = vec4(2*in_position-1, 0, 1);
        texCoord = in_position;
    }
#endif


#if FRAGMENT
    uniform vec4 nearFarPlanes; // (near, far, 1/near, 1/far)
    uniform sampler2D linearDepthTex;
    uniform sampler2D normalTex;
    
    in vec2 texCoord;
    out vec4 out_colour;
    
    void main()
    {

        float linearDepth = UnpackFloat(texture(linearDepthTex, texCoord));
        vec3 normal = texture(normalTex, texCoord).xyz;
        out_colour = vec4(linearDepth * normal, 1);
    }
#endif
